const express = require("express");
const router = express.Router();
const StoreController = require("../controllers/storeController");
const { verifyToken } = require("../middleware/auth");

// 公开接口
router.get("/", verifyToken, StoreController.getAllStores);
router.get("/page", verifyToken,StoreController.getStoresByPage);  // 新增分页路由
router.get("/nearby",verifyToken, StoreController.getNearbyStores);
router.get("/:id",verifyToken, StoreController.getStoreById);

// 需要管理员权限的接口
router.post("/", verifyToken, StoreController.createStore);
router.put("/:id", verifyToken, StoreController.updateStore);
router.delete("/:id", verifyToken, StoreController.deleteStore);

module.exports = router;
